package com.test.controller;

import com.test.domain.Cuisine;
import com.test.enums.Page;
import com.test.enums.Replay;
import com.test.service.CuisineService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * CuisneController
 *
 * @author HY
 * 2021/05/24 8:59
 **/

@Api(tags = "菜系管理接口")
@RestController
@RequestMapping("/admin/cuisne")
public class CuisneController {

    @Resource
    private CuisineService cuisineService;

    @PostMapping("/insert")
    @ApiOperation("添加菜系")
    public Replay insert(@RequestBody Cuisine cuisine){

        Replay replay = cuisineService.insert(cuisine);
        return replay;
    };

    @PostMapping("/del")
    @ApiOperation("删除菜系")
    public Replay del(@RequestBody int id){

        Replay replay = cuisineService.del(id);
        return replay;
    };

    @PostMapping("/update")
    @ApiOperation("修改菜系信息")
    public Replay update(@RequestBody Cuisine cuisine){

        Replay replay = cuisineService.update(cuisine);
        return replay;
    };

    @GetMapping("/select")
    @ApiOperation("查询菜系")
    public Replay select(@RequestParam Cuisine cuisine,@RequestParam  Page page){

        Replay replay = cuisineService.select(cuisine, page);
        return replay;
    };

}
